package request

// Casbin info structure
type CasbinInfo struct {
	Path   string `json:"path"`   // 路径
	Method string `json:"method"` // 方法
}

// Casbin structure for input parameters
type CasbinInReceive struct {
	AuthorityId string       `json:"authorityId"` // 权限id
	CasbinInfos []CasbinInfo `json:"casbinInfos"`
}

// DefaultCasbin 默认权限
func DefaultCasbin() []CasbinInfo {
	return []CasbinInfo{
		{Path: "/menu/getMenu", Method: "POST"},
		{Path: "/jwt/jsonInBlacklist", Method: "POST"},
		{Path: "/base/login", Method: "POST"},
		{Path: "/user/admin_register", Method: "POST"},
		{Path: "/user/changePassword", Method: "POST"},
		{Path: "/user/setUserAuthority", Method: "POST"},
		{Path: "/user/setUserInfo", Method: "PUT"},
		{Path: "/user/getUserInfo", Method: "GET"},
	}
}

func SuperCasbin() []CasbinInfo {
	return []CasbinInfo{
		//超级管理员 查看药店信息
		{Path: "/api/user-super/drug-shop", Method: "GET"},
		{Path: "/api/user-super/drug-shop/:shop_id", Method: "GET"},
		// 超级管理员 查看购药记录信息
		{Path: "/api/user-super/drug-record", Method: "GET"},

		//超级管理员 管理县区信息
		{Path: "/api/user-super/area", Method: "GET"},
		{Path: "/api/user-super/area", Method: "POST"},
		{Path: "/api/user-super/area/:area_id", Method: "DELETE"},
		{Path: "/api/user-super/area", Method: "PUT"},
		{Path: "/api/user-super/area/id-list", Method: "PUT"},
		// 超级管理员 查看县区用户信息
		{Path: "/api/super/area-info", Method: "GET"},
		{Path: "/api/super/area-action", Method: "PUT"},
		{Path: "/api/super/area-del", Method: "DELETE"},
		// 超级管理员 创建用户 管理个人信息
		{Path: "/api/super/user", Method: "POST"},
		{Path: "/api/super/super-info", Method: "GET"},
		{Path: "/api/super/super-action", Method: "PUT"},
		{Path: "/api/super/password", Method: "PUT"},
	}
}

func AreaCasbin() []CasbinInfo {
	return []CasbinInfo{
		{Path: "/api/record", Method: "GET"},
		{Path: "/aip/record/page", Method: "GET"},
		{Path: "/api/area/user", Method: "GET"},
		{Path: "/api/area/list", Method: "GET"},
		{Path: "/api/area/drugs-shop", Method: "GET"},
		{Path: "/api/excel/record", Method: "GET"},
		{Path: "/api/area/info", Method: "GET"},
		{Path: "/api/area/editor", Method: "PUT"},
		{Path: "/api/login", Method: "POST"},
		{Path: "/api/area/shop-keeper", Method: "POST"},
		{Path: "/api/area/add-shop", Method: "POST"},
		{Path: "/api/area/info-action", Method: "PUT"},
		{Path: "/api/area/password", Method: "PUT"},
		{Path: "/api/drug-record", Method: "PUT"},
		{Path: "/api/area/shop-action", Method: "DELETE"},
		{Path: "/api/drug-record/:drug_record_id", Method: "DELETE"},
	}
}

func DrugCasbin() []CasbinInfo {
	return []CasbinInfo{
		// 销售人员信息
		{Path: "/api/user-sale", Method: "GET"},
		{Path: "/api/user-sale", Method: "POST"},
		{Path: "/api/user-sale/:sale_id", Method: "DELETE"},
		{Path: "/api/user-sale", Method: "PUT"},
		{Path: "/api/user-sale/info", Method: "GET"},
		{Path: "/api/user-sale/info", Method: "PUT"},
		{Path: "/api/user-sale/password", Method: "PUT"},
		//  销售人员功能性API
		{Path: "/api/drug-record", Method: "POST"},
		{Path: "/api/drug-record", Method: "GET"},
		{Path: "/api/drug-record/:drug_record_id", Method: "DELETE"},
		{Path: "/api/drug-record", Method: "PUT"},
	}
}
